<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>前端测试页面</title>
</head>
<body>
    <h1>前端测试页面</h1>
    <p>如果你能看到这个页面，说明Web服务器正常工作。</p>

    <h2>API测试</h2>
    <button onclick="testBackendAPI()">测试后端API</button>
    <div id="api-result"></div>

    <h2>Vue应用测试</h2>
    <p>请在浏览器中打开 http://localhost:8106 查看Vue应用</p>

    <script>
        async function testBackendAPI() {
            const resultDiv = document.getElementById('api-result');
            try {
                const response = await fetch('http://localhost:4000/api/health');
                const data = await response.json();
                resultDiv.innerHTML = `
                    <h3>✅ 后端API正常</h3>
                    <pre>${JSON.stringify(data, null, 2)}</pre>
                `;
            } catch (error) {
                resultDiv.innerHTML = `
                    <h3>❌ 后端API连接失败</h3>
                    <p>${error.message}</p>
                `;
            }
        }

        // 页面加载时自动测试API
        window.onload = function() {
            testBackendAPI();
        };
    </script>
</body>
</html>